package com.hfjyz.system.depart.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hfjyz.base.exception.BaseException;
import com.hfjyz.system.depart.bean.DepartBean;
import com.hfjyz.system.depart.service.DepartService;
import com.opensymphony.xwork2.ActionSupport;

public class DepartAction extends ActionSupport {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -3775680677357523799L;

    private DepartService service = null;

    private Map<String, Object> map = new HashMap<String, Object>();

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }

    public DepartService getService() {
        return service;
    }

    public void setService(DepartService service) {
        this.service = service;
    }

    public String listDepart() throws BaseException {
        map = new HashMap<String, Object>();
        try {
            List<DepartBean> beanList = service.listDepart();
            map.put("departInfo", beanList);
            return SUCCESS;
        } catch (BaseException e) {
            map.put("errorMsg", e.getMessage());
            return ERROR;
        }
    }
}
